﻿// -----------------------------------------------------------------------
// <copyright file="AtoHelper.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace JumpJump.Tools
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using JumpJump.Offline;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class AtoHelper
    {
        public static void Process(string inFileFolder, string outFileFolder)
        {
            if (!Directory.Exists(outFileFolder))
            {
                Directory.CreateDirectory(outFileFolder);
            }

            DirectoryInfo dir = new DirectoryInfo(inFileFolder);
            FileInfo[] files = dir.GetFiles();
            foreach (FileInfo file in files)
            {
                string filename = file.Name;
                string path = file.FullName;
                string rawRep = outFileFolder + "\\" + filename + ".raw";
                string convertedRep = outFileFolder + "\\" + filename + ".converted";
                string manualFile = outFileFolder + "\\" + filename + ".manual";
                string datFile = outFileFolder + "\\" + filename + ".dat";
                AtoReplays rep = new AtoReplays();
                rep.Load(path,rawRep);
                rep.GetConvertedActionList(convertedRep);
                rep.GenerateChessManual(manualFile);
                rep.SaveChessManual(datFile);
            }
        }
    }
}
